package qfredis

import (
	"sync"

	"github.com/kataras/iris/v12"
)

const (
	qfCommonLockKey string = "qf_common_locker"
)

// QFCommonLock def
type QFCommonLock struct {
	qfCommonMutex sync.Mutex
}

var QFCommonLocker QFCommonLock

// Lock def
func (m *QFCommonLock) Lock(ctx iris.Context) bool {
	lock, _ := Lock(ctx, &m.qfCommonMutex, qfCommonLockKey, "1", 10)
	return lock
}

// UnLock def
func (m *QFCommonLock) UnLock(ctx iris.Context) {
	_ = UnLock(ctx, &m.qfCommonMutex, qfCommonLockKey)
}
